<?php
require_once('config.php');

$key=$_GET['key'];
$password=$_GET['password'];

$sql="select * from userinfo where username='$key' or telephone='$key'";

$result=mysqli_query($conn,$sql);

$count=mysqli_fetch_array($result);



$obj=array();

if($count){//用户存在判断密码
    if($password==$count['password']){
        $obj['code']=1;
        $obj['msg']='登录成功';
        $obj['data']=true;

    }else{
        $obj['code']=0;
        $obj['msg']='用户或密码错误';
        $obj['data']=false;
    }

}else{//用户不存在
    $obj['code']=0;
    $obj['msg']='用户或密码错误';
    $obj['data']=false;

}
echo json_encode($obj);